<template>
  <a-modal
    destroyOnClose
    :visible="visible"
    :title="title"
    @update:visible="update"
    @ok="ok"
  >
    <slot />
  </a-modal>
</template>

<script lang="ts" setup>
import { ref, defineProps, toRefs, defineEmits } from "vue";
const emits = defineEmits(["update:visible"]);
const props = defineProps({
  title: {
    type: String,
    default: "提示",
  },
  visible: {
    type: Boolean,
    default: false,
  },
});
const { title, visible } = toRefs(props);

function update(e) {
  emits("update:visible", e);
}
function ok() {
  emits("update:visible", false);
}
</script>

<style lang="less" scoped></style>
